/**
 * 描述: 服务-首页管理
 * 版权: Copyright (c) 2019
 * 公司: 深圳市网商天下科技开发有限公司
 * 作者: 许堉颖
 * 版本: 1.0.0
 * 创建时间: 2019/04/29 16:52
 */

import {Service, RequestParams} from 'vue-element-simple';

// ====================发票管理
/**
 * 分页获取拒接发票列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetInvoiceList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('search', params['search']);
  // 状态
  request.put('type', params['type']);
  // 状态
  request.put('status', params['status']);
  return await this.getService(`/admin/invoice/getPageList`, request);
};

/**
 * 根据id获取发票信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetInvoiceDetails = async function (params = {}) {
  const request = new RequestParams();
  // 发票id
  request.put('id', params['id'], 1);
  return await this.getService(`/admin/invoice/getDetailsById`, request);
};

/**
 * 删除发票
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteInvoice = async function (params = {}) {
  const request = new RequestParams();
  // 发票id
  request.put('id', params['id']).checkEmpty('发票ID');
  return await this.getService(`/admin/invoice/delete`, request);
};

/**
 * 修改发票状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationChangeInvoiceStatus = async function (params = {}) {
  const request = new RequestParams();
  // 发票id
  request.put('id', params['id']).checkEmpty('发票ID');
  // 状态
  request.put('status', params['status']).checkEmpty('状态');
  return await this.getService(`/admin/invoice/updateStatus`, request);
};
// ====================发票管理

